﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Solicitacao.aspx.cs" Inherits="Locadora.Views.Filme.Solicitacao" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
    
     <div class="corpo">
     <h2>Filme Solicitados</h2>
        <div class="notes">
            <h4>Informações</h4>
            <p>
                Please enter your full email address, for example, <strong>name@domain.com</strong></p>
            <p>
                It is important that you provide a valid, working email address that you have access
                to as it must be verified before you can use your account.</p>
            <p>
                Please enter a land line number, not a mobile phone number.</p>
            <p class="last">
                Your phone number will not be shared or used for telemarketing. Your information
                is protected by our <a title="View our Privacy Policy" href="http://jeffhowden.com/legal/privacy_policy/">
                    Privacy Policy</a>.</p>
    </div>
     <% if (ViewData["ErrorMessage"] != null)
        { %>
        <p class="erro">
            Ocorreu um erro:
            <br />
            <%= ViewData["ErrorMessage"] %>
            </p>
        <% } %>
        
        <p>Total Filme(s): <strong><%= ViewData["totalUsers"] %></strong></p>
        
         <% if ((int)ViewData["totalUsers"] == 0)
         { %>
                <p>Não existe filme(s).</p>
        <% }
       else
       { %>    
        <table class=list>
        <tr>
            <th>status</th>
            <th style="width:70px">&nbsp; </th>
            
            <th>locador</th>
            <th>título</th>
            <th>retirado/solicitado</th>
            <th>devolucao</th>
            <th>notificação</th>
            <th></th>
        </tr>
            <% foreach (Locadora.TOB.LocacaoTOB item in (List<Locadora.TOB.LocacaoTOB>)ViewData["users"])
               { %>
            <tr>
            <td>
                 &nbsp;<% = (Locadora.TOB.Enumeracao.SituacaoLocacao)item.ST_LOCACAO%>
                </td>
                <td>
                    <%if (item.ST_LOCACAO == (int)Locadora.TOB.Enumeracao.SituacaoLocacao.Solicitado && item.DT_DEVOLUCAO == null){ %>
                        <%= Html.ActionLink("Aprovar", "Aprovar", new { id = item.CO_DVD, coLocacao = item.CO_SEQ_LOCACAO })%>
                        <%= Html.ActionLink("Negar", "NaoAprovar", new { id = item.CO_DVD, coLocacao = item.CO_SEQ_LOCACAO })%>
                    <%}%>                   
                </td>
                <td>
                    <%string user = Membership.GetUser(new Guid(item.CO_USUARIO)).ToString();%>
                    <%= Html.ActionLink(user, "Classificacao", new { id = item.CO_USUARIO })%>
                </td>
                <td>
                    <%= Html.Encode(item.DS_TITULO) %>
                </td>
                <td>
                <%if(item.DT_LOCACAO != null){ %>
                    <%= Html.Encode(item.DT_LOCACAO.Value.ToShortDateString())%>
                    <%} %>
                </td>
                <td>
                <%if(item.DT_DEVOLUCAO != null){ %>
                    <%= Html.Encode(item.DT_DEVOLUCAO.Value.ToShortDateString())%>
                    <%} %>
                </td>
                <td>
                    <% if (item.ST_LOCACAO == (int)Locadora.TOB.Enumeracao.SituacaoLocacao.Aceito && item.DT_DEVOLUCAO != null && item.DT_DEVOLUCAO < DateTime.Now)
                       { %>
                        <font color=red>Atrasado</font>
                   <%} %>
                </td>
                <td>
                <%if (item.ST_LOCACAO == (int)Locadora.TOB.Enumeracao.SituacaoLocacao.Devolvido && item.ST_QUALIFICADO==false)
                  {%>
                    <%= Html.ActionLink("Qualificar", "Classificar", new { id = item.CO_USUARIO, coLocacao = item.CO_SEQ_LOCACAO, titulo = Html.Encode(item.DS_TITULO) })%>
                <%} %>
                </td>
            </tr>
            <% } %>
        </table>
<br />
        <% if ((string)ViewData["pageLinks"] != "")
           { %>
           <%= ViewData["pageLinks"] %>
           <br /><br />
        <% } %>
        
        <%}%>
        
</div>
</asp:Content>
